package com.edu.employee.controller;

import com.edu.commons.R;
import com.edu.employee.pojo.entity.Dept;
import com.edu.employee.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ProjectName: summer-project
 * @Titile: DeptController
 * @Author: Lucky
 * @Description: 部门控制类
 */
@RestController
@RequestMapping("/api/dept")
public class DeptController {
    //注入部门业务层
    @Autowired
    private DeptService deptService;

    /**
     * 获取部门列表
     * @return 部门列表
     */
    @GetMapping("list")
    public R<List<Dept>> getDeptList(){
       List<Dept> deptList =  deptService.getList();
       return R.ok("查询部门列表成功",deptList);
    }
}
